<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="my.dao.*" %>
    
<%
	//request代表了手机端发来的请求数据
	String u_pwd = request.getParameter("u_pwd");
	String u_repwd = request.getParameter("u_repwd");
	
	if(u_pwd==null || u_repwd == null || !u_pwd.equals(u_repwd)){
		out.print(MyDao.jsonResult(false, "两次密码输入不一致或者没有输入密码！"));
		return;
	}
	
	
	String u_id = request.getParameter("u_id");
	String u_name = request.getParameter("u_name");
	String u_sex = request.getParameter("u_sex");
	String u_birth = request.getParameter("u_birth");
	String u_edu = request.getParameter("u_edu");
	
	String[] u_hobby = request.getParameterValues("u_hobby");//特殊
	String hobby = "";
	for(int i=0;i<u_hobby.length;i++){
		if(i==0){
			hobby+=u_hobby[i];
		}else{
			hobby+=","+u_hobby[i];
		}
	}
	
	//执行insert语句将数据插入数据库中
	String sql=
	"insert into "+
	"t_user(u_id,u_name,u_pwd,u_sex,u_birth,u_edu,u_hobby) "+
	"values(?,?,?,?,?,?,?)";
	
	MyDao.update(sql, u_id,u_name,u_pwd,u_sex,u_birth,u_edu,hobby);
	
	String result = MyDao.jsonResult(true, "注册成功!");
	
	out.print(result);

%>    













